home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / include / opcode / m68k.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-04  |  11.3 KB  |  303 lines

  1. /* Opcode table header for m680[01234]0/m6888[12]/m68851.
  2.    Copyright 1989, 1991, 1992, 1993, 1994, 1995 Free Software Foundation.
  3.  
  4. This file is part of GDB, GAS, and the GNU binutils.
  5.  
  6. GDB, GAS, and the GNU binutils are free software; you can redistribute
  7. them and/or modify them under the terms of the GNU General Public
  8. License as published by the Free Software Foundation; either version
  9. 1, or (at your option) any later version.
  10.  
  11. GDB, GAS, and the GNU binutils are distributed in the hope that they
  12. will be useful, but WITHOUT ANY WARRANTY; without even the implied
  13. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  14. the GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this file; see the file COPYING.  If not, write to the Free
  18. Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  19. 02111-1307, USA.  */
  20.  
  21. /* These are used as bit flags for the arch field in the m68k_opcode
  22.    structure.  */
  23. #define    _m68k_undef  0
  24. #define    m68000  0x001
  25. #define    m68008  m68000 /* synonym for -m68000.  otherwise unused. */
  26. #define    m68010  0x002
  27. #define    m68020  0x004
  28. #define    m68030  0x008
  29. #define m68ec030 m68030 /* similar enough to -m68030 to ignore differences;
  30.                gas will deal with the few differences.  */
  31. #define    m68040  0x010
  32. /* there is no 68050 */
  33. #define m68060  0x020
  34. #define    m68881  0x040
  35. #define    m68882  m68881 /* synonym for -m68881.  otherwise unused. */
  36. #define    m68851  0x080
  37. #define cpu32    0x100    /* e.g., 68332 */
  38. #define mcf5200 0x200
  39.  
  40.  /* handy aliases */
  41. #define    m68040up  (m68040 | m68060)
  42. #define    m68030up  (m68030 | m68040up)
  43. #define    m68020up  (m68020 | m68030up)
  44. #define    m68010up  (m68010 | cpu32 | m68020up)
  45. #define    m68000up  (m68000 | m68010up)
  46.  
  47. #define    mfloat  (m68881 | m68882 | m68040 | m68060)
  48. #define    mmmu    (m68851 | m68030 | m68040 | m68060)
  49.  
  50. /* The structure used to hold information for an opcode.  */
  51.  
  52. struct m68k_opcode
  53. {
  54.   /* The opcode name.  */
  55.   const char *name;
  56.   /* The opcode itself.  */
  57.   unsigned long opcode;
  58.   /* The mask used by the disassembler.  */
  59.   unsigned long match;
  60.   /* The arguments.  */
  61.   const char *args;
  62.   /* The architectures which support this opcode.  */
  63.   unsigned int arch;
  64. };
  65.  
  66. /* The structure used to hold information for an opcode alias.  */
  67.  
  68. struct m68k_opcode_alias
  69. {
  70.   /* The alias name.  */
  71.   const char *alias;
  72.   /* The instruction for which this is an alias.  */
  73.   const char *primary;
  74. };
  75.  
  76. /* We store four bytes of opcode for all opcodes because that is the
  77.    most any of them need.  The actual length of an instruction is
  78.    always at least 2 bytes, and is as much longer as necessary to hold
  79.    the operands it has.
  80.  
  81.    The match field is a mask saying which bits must match particular
  82.    opcode in order for an instruction to be an instance of that
  83.    opcode.
  84.  
  85.    The args field is a string containing two characters for each
  86.    operand of the instruction.  The first specifies the kind of
  87.    operand; the second, the place it is stored.  */
  88.  
  89. /* Kinds of operands:
  90.    Characters used: AaBCcDdFfIJkLlMOQRrSsTtUVWXYZ0123|*~%;@!&$?/#^+-
  91.  
  92.    D  data register only.  Stored as 3 bits.
  93.    A  address register only.  Stored as 3 bits.
  94.    a  address register indirect only.  Stored as 3 bits.
  95.    R  either kind of register.  Stored as 4 bits.
  96.    r  either kind of register indirect only.  Stored as 4 bits.
  97.       At the moment, used only for cas2 instruction.
  98.    F  floating point coprocessor register only.   Stored as 3 bits.
  99.    O  an offset (or width): immediate data 0-31 or data register.
  100.       Stored as 6 bits in special format for BF... insns.
  101.    +  autoincrement only.  Stored as 3 bits (number of the address register).
  102.    -  autodecrement only.  Stored as 3 bits (number of the address register).
  103.    Q  quick immediate data.  Stored as 3 bits.
  104.       This matches an immediate operand only when value is in range 1 .. 8.
  105.    M  moveq immediate data.  Stored as 8 bits.
  106.       This matches an immediate operand only when value is in range -128..127
  107.    T  trap vector immediate data.  Stored as 4 bits.
  108.  
  109.    k  K-factor for fmove.p instruction.   Stored as a 7-bit constant or
  110.       a three bit register offset, depending on the field type.
  111.  
  112.    #  immediate data.  Stored in special places (b, w or l)
  113.       which say how many bits to store.
  114.    ^  immediate data for floating point instructions.   Special places
  115.       are offset by 2 bytes from '#'...
  116.    B  pc-relative address, converted to an offset
  117.       that is treated as immediate data.
  118.    d  displacement and register.  Stores the register as 3 bits
  119.       and stores the displacement in the entire second word.
  120.  
  121.    C  the CCR.  No need to store it; this is just for filtering validity.
  122.    S  the SR.  No need to store, just as with CCR.
  123.    U  the USP.  No need to store, just as with CCR.
  124.  
  125.    I  Coprocessor ID.   Not printed if 1.   The Coprocessor ID is always
  126.       extracted from the 'd' field of word one, which means that an extended
  127.       coprocessor opcode can be skipped using the 'i' place, if needed.
  128.  
  129.    s  System Control register for the floating point coprocessor.
  130.  
  131.    J  Misc register for movec instruction, stored in 'j' format.
  132.     Possible values:
  133.     0x000    SFC    Source Function Code reg    [60, 40, 30, 20, 10]
  134.     0x001    DFC    Data Function Code reg        [60, 40, 30, 20, 10]
  135.     0x002    CACR    Cache Control Register        [60, 40, 30, 20]
  136.     0x003    TC    MMU Translation Control        [60, 40]
  137.     0x004    ITT0    Instruction Transparent
  138.                 Translation reg 0    [60, 40]
  139.     0x005    ITT1    Instruction Transparent
  140.                 Translation reg 1    [60, 40]
  141.     0x006    DTT0    Data Transparent
  142.                 Translation reg 0    [60, 40]
  143.     0x007    DTT1    Data Transparent
  144.                 Translation reg 1    [60, 40]
  145.     0x008    BUSCR    Bus Control Register        [60]
  146.     0x800    USP    User Stack Pointer        [60, 40, 30, 20, 10]
  147.     0x801    VBR    Vector Base reg            [60, 40, 30, 20, 10]
  148.     0x802    CAAR    Cache Address Register        [        30, 20]
  149.     0x803    MSP    Master Stack Pointer        [    40, 30, 20]
  150.     0x804    ISP    Interrupt Stack Pointer        [    40, 30, 20]
  151.     0x805    MMUSR    MMU Status reg            [    40]
  152.     0x806    URP    User Root Pointer        [60, 40]
  153.     0x807    SRP    Supervisor Root Pointer        [60, 40]
  154.     0x808    PCR    Processor Configuration reg    [60]
  155.     0xC00    ROMBAR    ROM Base Address Register    [520X]
  156.     0xC04    RAMBAR0    RAM Base Address Register 0    [520X]
  157.     0xC05    RAMBAR1    RAM Base Address Register 0    [520X]
  158.     0xC0F    MBAR0    RAM Base Address Register 0    [520X]
  159.  
  160.     L  Register list of the type d0-d7/a0-a7 etc.
  161.        (New!  Improved!  Can also hold fp0-fp7, as well!)
  162.        The assembler tries to see if the registers match the insn by
  163.        looking at where the insn wants them stored.
  164.  
  165.     l  Register list like L, but with all the bits reversed.
  166.        Used for going the other way. . .
  167.  
  168.     c  cache identifier which may be "nc" for no cache, "ic"
  169.        for instruction cache, "dc" for data cache, or "bc"
  170.        for both caches.  Used in cinv and cpush.  Always
  171.        stored in position "d".
  172.  
  173.  The remainder are all stored as 6 bits using an address mode and a
  174.  register number; they differ in which addressing modes they match.
  175.  
  176.    *  all                    (modes 0-6,7.*)
  177.    ~  alterable memory                (modes 2-6,7.0,7.1)
  178.                            (not 0,1,7.~)
  179.    %  alterable                    (modes 0-6,7.0,7.1)(not 7.~)
  180.    ;  data                    (modes 0,2-6,7.*)(not 1)
  181.    @  data, but not immediate            (modes 0,2-6,7.? ? ?)
  182.                         (not 1,7.?)
  183.                         This may really be ;,
  184.                         the 68020 book says it is
  185.    !  control                    (modes 2,5,6,7.*-)
  186.                         (not 0,1,3,4,7.4)
  187.    &  alterable control                (modes 2,5,6,7.0,7.1)
  188.                         (not 0,1,7.? ? ?)
  189.    $  alterable data                (modes 0,2-6,7.0,7.1)
  190.                         (not 1,7.~)
  191.    ?  alterable control, or data register    (modes 0,2,5,6,7.0,7.1)
  192.                         (not 1,3,4,7.~)
  193.    /  control, or data register            (modes 0,2,5,6,7.0,7.1,7.2,7.3)
  194.                         (not 1,3,4,7.4)
  195.    `  control, plus pre-dec, not simple indir.    (modes 4,5,6,7.*-)
  196.                         (not 0,1,2,3,7.4) */
  197.  
  198. /* For the 68851: */
  199. /*
  200.    I didn't use much imagination in choosing the 
  201.    following codes, so many of them aren't very
  202.    mnemonic. -rab
  203.  
  204.    0  32 bit pmmu register
  205.     Possible values:
  206.     000    TC    Translation Control Register (68030, 68851)
  207.  
  208.    1  16 bit pmmu register
  209.     111    AC    Access Control (68851)
  210.  
  211.    2  8 bit pmmu register
  212.     100    CAL    Current Access Level (68851)
  213.     101    VAL    Validate Access Level (68851)
  214.     110    SCC    Stack Change Control (68851)
  215.  
  216.    3  68030-only pmmu registers (32 bit)
  217.     010    TT0    Transparent Translation reg 0
  218.             (aka Access Control reg 0 -- AC0 -- on 68ec030)
  219.     011    TT1    Transparent Translation reg 1
  220.             (aka Access Control reg 1 -- AC1 -- on 68ec030)
  221.  
  222.    W  wide pmmu registers
  223.     Possible values:
  224.     001    DRP    Dma Root Pointer (68851)
  225.     010    SRP    Supervisor Root Pointer (68030, 68851)
  226.     011    CRP    Cpu Root Pointer (68030, 68851)
  227.  
  228.    f    function code register (68030, 68851)
  229.     0    SFC
  230.     1    DFC
  231.  
  232.    V    VAL register only (68851)
  233.  
  234.    X    BADx, BACx (16 bit)
  235.     100    BAD    Breakpoint Acknowledge Data (68851)
  236.     101    BAC    Breakpoint Acknowledge Control (68851)
  237.  
  238.    Y    PSR (68851) (MMUSR on 68030) (ACUSR on 68ec030)
  239.    Z    PCSR (68851)
  240.  
  241.    |    memory         (modes 2-6, 7.*)
  242.  
  243.    t  address test level (68030 only)
  244.       Stored as 3 bits, range 0-7.
  245.       Also used for breakpoint instruction now.
  246.  
  247. */
  248.  
  249. /* Places to put an operand, for non-general operands:
  250.    s  source, low bits of first word.
  251.    d  dest, shifted 9 in first word
  252.    1  second word, shifted 12
  253.    2  second word, shifted 6
  254.    3  second word, shifted 0
  255.    4  third word, shifted 12
  256.    5  third word, shifted 6
  257.    6  third word, shifted 0
  258.    7  second word, shifted 7
  259.    8  second word, shifted 10
  260.    9  second word, shifted 5
  261.    D  store in both place 1 and place 3; for divul and divsl.
  262.    B  first word, low byte, for branch displacements
  263.    W  second word (entire), for branch displacements
  264.    L  second and third words (entire), for branch displacements
  265.       (also overloaded for move16)
  266.    b  second word, low byte
  267.    w  second word (entire) [variable word/long branch offset for dbra]
  268.    W  second word (entire) (must be signed 16 bit value)
  269.    l  second and third word (entire)
  270.    g  variable branch offset for bra and similar instructions.
  271.       The place to store depends on the magnitude of offset.
  272.    t  store in both place 7 and place 8; for floating point operations
  273.    c  branch offset for cpBcc operations.
  274.       The place to store is word two if bit six of word one is zero,
  275.       and words two and three if bit six of word one is one.
  276.    i  Increment by two, to skip over coprocessor extended operands.   Only
  277.       works with the 'I' format.
  278.    k  Dynamic K-factor field.   Bits 6-4 of word 2, used as a register number.
  279.       Also used for dynamic fmovem instruction.
  280.    C  floating point coprocessor constant - 7 bits.  Also used for static
  281.       K-factors...
  282.    j  Movec register #, stored in 12 low bits of second word.
  283.  
  284.  Places to put operand, for general operands:
  285.    d  destination, shifted 6 bits in first word
  286.    b  source, at low bit of first word, and immediate uses one byte
  287.    w  source, at low bit of first word, and immediate uses two bytes
  288.    l  source, at low bit of first word, and immediate uses four bytes
  289.    s  source, at low bit of first word.
  290.       Used sometimes in contexts where immediate is not allowed anyway.
  291.    f  single precision float, low bit of 1st word, immediate uses 4 bytes
  292.    F  double precision float, low bit of 1st word, immediate uses 8 bytes
  293.    x  extended precision float, low bit of 1st word, immediate uses 12 bytes
  294.    p  packed float, low bit of 1st word, immediate uses 12 bytes
  295. */
  296.  
  297. extern const struct m68k_opcode m68k_opcodes[];
  298. extern const struct m68k_opcode_alias m68k_opcode_aliases[];
  299.  
  300. extern const int m68k_numopcodes, m68k_numaliases;
  301.  
  302. /* end of m68k-opcode.h */
  303.